using System;
using Csla;
using System.Collections;
namespace Company.Business.Article
{
	[Serializable]
	public partial class ModelClass1 : BusinessBase<ModelClass1>
	{

		#region Business Methods
		protected override object GetIdValue()
		{
			return ;
		}

		#endregion

		#region Business Rules
		protected override void AddBusinessRules()
		{
			base.AddBusinessRules();

		}

		#endregion

		#region Factory Methods
		internal static ModelClass1 New()
		{
			var modelclass1 = DataPortal.CreateChild<ModelClass1>();
			return modelclass1;
		}

		internal static ModelClass1 Get(object fetchData)
		{
			return DataPortal.FetchChild<ModelClass1>(fetchData);
		}

		private ModelClass1()
		{
			/* Require use of factory methods */ 
		}

		#endregion

		#region Data Portal
		[RunLocal]
		protected override void Child_Create()
		{
			//load default values here
			//omit this override if you have no defaults to set
			base.DataPortal_Create();
		}

		// ReSharper disable UnusedMember.Local
		private void Child_Fetch(object fetchData)
		// ReSharper restore UnusedMember.Local
		{
			using (BypassPropertyChecks)
			{
				//Stub: Write fetchdata to the CSLA Object 
			}

		}

		 [Transactional(TransactionalTypes.TransactionScope)]
		// ReSharper disable UnusedMember.Local
		// ReSharper disable UnusedParameter.Local
		private void Child_Insert(object parent)
		// ReSharper restore UnusedParameter.Local
		// ReSharper restore UnusedMember.Local
		{
			using (BypassPropertyChecks)
			{
				//Stub: Write Data to a new DB Object
				//dbObject.Save();
			}

			FieldManager.UpdateChildren(this);
		}

		// ReSharper disable UnusedMember.Local
		 [Transactional(TransactionalTypes.TransactionScope)]
		private void Child_Update(object parent)
		// ReSharper restore UnusedMember.Local
		{
			if (IsSelfDirty)
			{
				using (BypassPropertyChecks)
				{
					//Stub: Write Data to the corresponding DB Object
					//dbObject.Save();
				}

			}

			FieldManager.UpdateChildren(this);
		}

		 [Transactional(TransactionalTypes.TransactionScope)]
		// ReSharper disable UnusedMember.Local
		private void Child_DeleteSelf(object parent)
		// ReSharper restore UnusedMember.Local
		{
			//Stub: Delete the corresponding DB Object
			=0;
		}

		#endregion
	}

}

